enum RouteResult { success, error, redirectToLogin }

class RouteCompletion {
  RouteResult result;
  dynamic param;

  RouteCompletion({required this.result, this.param});
}

abstract class RouterServiceDelegate {
  Future<RouteCompletion> handle({
    required String url,
    Map<String, dynamic>? params,
  });
}

abstract class RouterService {
  RouterServiceDelegate? delegate;

  RouterService();

  Future<List<String>?> get urls;

  /// Push native page
  Future<RouteCompletion?> push(
    String url, {
    Map<String, dynamic>? params,
    bool animated = true,
  });

  Future<bool?> pop({int delta = 1, dynamic value, bool animated = true});

  void finish({required List<String> urls});

  /// Present native page
  Future<RouteCompletion?> present(
    String url, {
    Map<String, dynamic>? params,
    bool animated = true,
  });

  Future<bool?> dismiss({dynamic value, bool animated = true});

  /// Run handler
  Future<RouteCompletion?> handle(
    String url, {
    Map<String, dynamic>? params,
  });

  Future<String?> alert(
      {String? title,
      required String message,
      String? confirmButtonText,
      bool interactive = false});

  Future<String?> confirm(
      {String? title,
      required String message,
      String? confirmButtonText,
      String? cancelButtonText,
      bool interactive = false});

  Future<bool?> toast({required String message, bool interactive = false});

  Future<bool?> loading({required String message, bool interactive = false});

  Future<bool?> closeToast();
}
